hebbian learning rule python code